package embyparse.noobparser;

import embyparse.parsetree.ParseNode;
import embyparse.tokenizer.Token;

/**
 * Raw pattern represents a 1-to-1 correspondence between a token and a pattern.
 * <br><br>Ex.<br>
 * @author Justin
 *
 */
public class RawPattern extends Pattern{



	public RawPattern(String name) {
		super(name);
	}

	public RawPattern(String name, int precedence){
		super( name, precedence);
	}

	public ParseNode match(Token t){
		//System.out.print(t.getString()+"="+name+"?");
		if(t.getString().equals(name)){
			//System.out.println("yes");
			return new ParseNode(this,t,null);
		}
		//System.out.println("no");
		return null;
	}

	public RawPattern add(){
		super.add();
		PatternDefinitions.rawpatterns.add(this);
		return this;
	}

	public RawPattern setSuperPattern(String s){
		super.setSuperPattern(s);
		return this;
	}
}
